# HG changeset patch # User Christophe de Vienne <christophe@cdevienne.info> # Date 1471625894 -7200 # Node ID bdfacbcf700e581b54707e5c8c69e11cac5340ec # Parent acf857ef0abe481e0c7db122dad15d8dcfd52242 Friendlier patch urls & mimetype Replace /changeset/<revset>/patch/ by /changeset/<revset>.patch and set the mimetype to text/x-diff. This helps the browser opening the right application thanks to the mimetype, and the application to better guess the file type thanks to the '.patch' extension diff -r acf857ef0abe -r bdfacbcf700e review/templates/changeset.html --- a/review/templates/changeset.html Fri Dec 12 11:17:43 2014 +0100 +++ b/review/templates/changeset.html Fri Aug 19 18:58:14 2016 +0200 @@ -25,7 +25,7 @@ {% block content %} <div class="group head"> <div class="committer-avatar" style="background: transparent url('{{ utils['cset_gravatar'](rev, 60) }}') top left no-repeat"> </div> - <div class="patch"><a href="/changeset/{{ utils['node_short'](rev.node()) }}/patch/">Download Patch ↓</a></div> + <div class="patch"><a href="/changeset/{{ utils['node_short'](rev.node()) }}.patch">Download Patch ↓</a></div> <h2> {{ rev.rev() }}: diff -r acf857ef0abe -r bdfacbcf700e review/web.py --- a/review/web.py Fri Dec 12 11:17:43 2014 +0100 +++ b/review/web.py Fri Aug 19 18:58:14 2016 +0200 @@ -213,7 +213,7 @@ newer=newer, older=older) -@app.route('/changeset/<revhash>/patch/') +@app.route('/changeset/<revhash>.patch') def patch(revhash): result = StringIO.StringIO() try: @@ -224,7 +224,7 @@ abort(404) except UnicodeEncodeError: abort(404) - return Response(result.getvalue(), content_type="application/octet-stream") + return Response(result.getvalue(), content_type="text/x-patch") @app.route('/pull/', methods=['POST']) def pull():